package com.wyth.lottery.activity;


import android.app.AlertDialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.wyth.lottery.R;
import com.wyth.lottery.base.BaseActivity;
import com.wyth.lottery.utils.MyApplication;

import butterknife.BindView;
import butterknife.OnClick;

public class MainActivity extends BaseActivity {

    @BindView(R.id.iv_ssq)
    ImageView ivSsq;
    @BindView(R.id.iv_three)
    ImageView ivThree;
    @BindView(R.id.iv_other)
    ImageView ivOther;
    @BindView(R.id.tv_duijiang)
    TextView tvDuijiang;
    @BindView(R.id.tv_jifen)
    TextView tvJifen;
    @BindView(R.id.tv_fuwu)
    TextView tvFuwu;
    @BindView(R.id.tv_kefu)
    TextView tvKefu;

    @Override
    protected int getContentID() {
        return R.layout.activity_main;
    }

    @Override
    protected void initView() {
//        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
//        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
//        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//        setContentView(R.layout.activity_main);
    }

    @Override
    protected void initDate() {

    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        }
    }

    @OnClick({R.id.iv_ssq, R.id.iv_three, R.id.iv_other, R.id.tv_duijiang, R.id.tv_jifen, R.id.tv_fuwu, R.id.tv_kefu})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_ssq:
                Intent intent = new Intent(MainActivity.this, SSQHomeActivity.class);
                startActivity(intent);
                break;
            case R.id.iv_three:
                startActivity(new Intent(MainActivity.this, QThreeActivity.class));
                break;
            case R.id.iv_other:
                startActivity(new Intent(MainActivity.this, OtherActivity.class));
                break;
            case R.id.tv_duijiang://兑奖
                Intent intent1=new Intent(MyApplication.getContext(),PrizeActivity.class);
                intent1.putExtra("start_state","dj");
                startActivity(intent1);

                break;
            case R.id.tv_jifen:
                startActivity(new Intent(MainActivity.this, PointsActivity.class));
                break;
            case R.id.tv_fuwu:
                startActivity(new Intent(MainActivity.this, CaiminServiceActivity.class));
                break;
            case R.id.tv_kefu:  //联系客服
                kefuDialog();
                break;
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
    }



    private void kefuDialog() {
        View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.kefu_dialog, null);
        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
        builder.setView(view).create();
        final AlertDialog show = builder.show();
        view.findViewById(R.id.tv_true).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                show.dismiss();
            }
        });
    }



}
